import Vue from 'vue'
import store from '@/store'
import {
  guid,
  checkNetWork
} from './utils'
var SQliteMethods = {}

// 判断是否接入网络连接
export function ifOnline() {
  if (navigator.onLine) {
    return true
  } else {
    //执行离线状态时的任务   
    return false
}
}
//创建本地部门树数数据表
export function createDeptTree(data) {
  console.log(data);
  store.state.SQLiteDB.transaction((tx) => {
    tx.executeSql('DROP TABLE IF EXISTS DEPT_TREE');
    tx.executeSql('CREATE TABLE IF NOT EXISTS DEPT_TREE(tempId unique, ID, NAME, ORG_PATHID, ORG_PATHNAME, PARENTID)');
    for (let i = 0; i < data.length; i++) {
      tx.executeSql('INSERT INTO DEPT_TREE (tempId,ID,NAME,ORG_PATHID,ORG_PATHNAME,PARENTID) VALUES ("' + guid() +
        '","' + data[i].ID + '", "' + data[i].NAME + '", "' + data[i].ORG_PATHID + '", "' + data[i].ORG_PATHNAME + '", "' + data[i].PARENTID + '")');
    }
  }, (err) => {
    // console.log('错误12323432423423423423', err)
  })
};
//创建本地选人控件人员数据
export function createPersonsTable(data) {
  store.state.SQLiteDB.transaction((tx) => {
    tx.executeSql('DROP TABLE IF EXISTS PERSON_TREE');
    tx.executeSql('CREATE TABLE IF NOT EXISTS PERSON_TREE(tempId unique, GUID, FIRSTDEPTNAME, ' +
      'GROUPPATHID, GROUPPATHNAME, JOIN_TIME, NATION, ORG_ID, ORG_NAME, ORG_PATHID, ORG_PATHNAME, PEOPLES, PRJID, ' +
      'RN_, SECONDDEPTNAME, TELEPHONE_CODE, THIRDDEPTNAME, TT_, UNITID, USERGUID, USER_FULLNAME, USER_NAME)');

    for (let i = 0; i < data.length; i++) {
      //用到此表时根据org_id查询相关人员
      tx.executeSql('INSERT INTO PERSON_TREE (tempId, GUID, FIRSTDEPTNAME, GROUPPATHID, GROUPPATHNAME, JOIN_TIME, NATION, ORG_ID, ' +
        'ORG_NAME, ORG_PATHID, ORG_PATHNAME, PEOPLES, PRJID, RN_, SECONDDEPTNAME, TELEPHONE_CODE, THIRDDEPTNAME, TT_, UNITID, USERGUID, ' +
        'USER_FULLNAME, USER_NAME) VALUES ("' + guid() + '","' + data[i].GUID + '","' + data[i].FIRSTDEPTNAME + '","' + data[i].GROUPPATHID +
        '","' + data[i].GROUPPATHNAME + '"' + ',"' + data[i].JOIN_TIME + '","' + data[i].NATION + '","' + data[i].ORG_ID + '","' + data[i].ORG_NAME +
        '","' + data[i].ORG_PATHID + '"' + ',"' + data[i].ORG_PATHNAME + '","' + data[i].PEOPLES + '","' + data[i].PRJID + '","' + data[i].RN_ +
        '","' + data[i].SECONDDEPTNAME + '"' + ',"' + data[i].TELEPHONE_CODE + '","' + data[i].THIRDDEPTNAME + '","' + data[i].TT_ + '","' + data[i].UNITID +
        '","' + data[i].USERGUID + '"' + ',"' + data[i].USER_FULLNAME + '","' + data[i].USER_NAME + '")');

    }
  }, (err) => {
    console.log('错误', err)
  })
};
// 创建本地SQlite数据库并插入安全检查类别数据
export function createHSETable(aa) {
  store.state.SQLiteDB.transaction((tx) => {
    tx.executeSql('DROP TABLE IF EXISTS PMHSE_SUBCLASSW');
    tx.executeSql('CREATE TABLE IF NOT EXISTS PMHSE_SUBCLASSW (id unique, FATHERCLASS, FATHERCLASS_TEXT,CHILDCLASS,CHILDCLASS_TEXT,IMPORTANCE,WEIGHT)');
    for (let i = 0; i < aa.length; i++) {
      tx.executeSql('INSERT INTO PMHSE_SUBCLASSW (id,FATHERCLASS, FATHERCLASS_TEXT,CHILDCLASS,CHILDCLASS_TEXT,IMPORTANCE,WEIGHT) VALUES ("' + guid() + '", "' + aa[i].FATHERCLASS + '", "' + aa[i].FATHERCLASS_TEXT + '", "' + aa[i].CHILDCLASS + '", "' + aa[i].CHILDCLASS_TEXT + '", "' + aa[i].IMPORTANCE + '", "' + aa[i].WEIGHT + '")')

    }
    tx.executeSql('SELECT * FROM PMHSE_SUBCLASSW', [], (tx, result) => {
      // console.log("输出1111111",result)
    })
  }, (err) => {
    console.log('错误', err)
  })
};
// 创建本地检查项目检查项数据表
export function createHSECheckList(aa) {
  store.state.SQLiteDB.transaction((tx) => {
    tx.executeSql('DROP TABLE IF EXISTS PMHSE_CHECKLISTW');
    tx.executeSql('CREATE TABLE IF NOT EXISTS PMHSE_CHECKLISTW (id unique, CHECKPRO, CHECKPRO_TEXT, CHECKITEMS, CHECKITEMS_TEXT, CHILDCLASS, FATHERCLASS, FATHERCLASS_TEXT)');
    for (let i = 0; i < aa.length; i++) {
      tx.executeSql('INSERT INTO PMHSE_CHECKLISTW (id, CHECKPRO, CHECKPRO_TEXT, CHECKITEMS, CHECKITEMS_TEXT, CHILDCLASS, FATHERCLASS, FATHERCLASS_TEXT) VALUES ("' + guid() + '", "' + aa[i].CHECKPRO + '", "' + aa[i].CHECKPRO_TEXT + '", "' + aa[i].CHECKITEMS + '","' + aa[i].CHECKITEMS_TEXT + '","' + aa[i].CHILDCLASS + '","' + aa[i].FATHERCLASS + '","' + aa[i].FATHERCLASS_TEXT + '")')

    }
    tx.executeSql('SELECT * FROM PMHSE_CHECKLISTW', [], (tx, result) => {
      // console.log("输出2222222",result)
    })
  }, (err) => {
    console.log('错误', err)
  })
};
// 创建本地项目项目部数据表(表单填写用)
export function createHSEGetproject(aa) {
  store.state.SQLiteDB.transaction((tx) => {
    tx.executeSql('DROP TABLE IF EXISTS PMBASE_PRJMAN');
    tx.executeSql('CREATE TABLE IF NOT EXISTS PMBASE_PRJMAN (id unique, PROJECTNAME, PROJECTNO, PROJECTID, ISPRJMANAG, POSITIONNAME, POSITION, CENTERPOSITION, INPUTDATE, QUALITYUSERFULLNAME6, QUALITYUSERNAME6,SECURITYUSERFULLNAME,SECURITYUSERNAME,SECURITYUSERFULLNAME2,SECURITYUSERNAME2)');
    for (let i = 0; i < aa.length; i++) {
      tx.executeSql('INSERT INTO PMBASE_PRJMAN (id, PROJECTNAME, PROJECTNO, PROJECTID, ISPRJMANAG, POSITIONNAME, POSITION, CENTERPOSITION, INPUTDATE, QUALITYUSERFULLNAME6, QUALITYUSERNAME6,SECURITYUSERFULLNAME,SECURITYUSERNAME,SECURITYUSERFULLNAME2,SECURITYUSERNAME2) VALUES ("' + guid() + '", "' + aa[i].PROJECTNAME + '", "' + aa[i].PROJECTNO + '", "' + aa[i].PROJECTID + '","' + aa[i].ISPRJMANAG + '","' + aa[i].POSITIONNAME + '","' + aa[i].POSITION + '","' + aa[i].CENTERPOSITION + '","' + aa[i].INPUTDATE + '","' + aa[i].QUALITYUSERFULLNAME6 + '","' + aa[i].QUALITYUSERNAME6 + '","' + aa[i].SECURITYUSERFULLNAME + '","' + aa[i].SECURITYUSERNAME + '","' + aa[i].SECURITYUSERFULLNAME2 + '","' + aa[i].SECURITYUSERNAME2 + '")')
    }
    tx.executeSql('SELECT * FROM PMBASE_PRJMAN', [], (tx, result) => {
       console.log("输出33333",result)
    })
  }, (err) => {
    console.log('错误', err)
  })
};
// 创建项目部分支数据表
export function createHSEGetprojectChild(aa) {
  store.state.SQLiteDB.transaction((tx) => {
    tx.executeSql('DROP TABLE IF EXISTS PMBASE_PRJFORINSPECT');
    tx.executeSql('CREATE TABLE IF NOT EXISTS PMBASE_PRJFORINSPECT (id unique, PMNAME, RELATEID, PROJECTNAME, PROJECTNO, PRJDEPTNAME, PRJTYPE, PROJECTID ,PMID)');
    for (let i = 0; i < aa.length; i++) {
      tx.executeSql('INSERT INTO PMBASE_PRJFORINSPECT (id, PMNAME, RELATEID, PROJECTNAME, PROJECTNO, PRJDEPTNAME, PRJTYPE, PROJECTID,PMID) VALUES ("' + guid() + '", "' + aa[i].PMNAME + '", "' + aa[i].RELATEID + '", "' + aa[i].PROJECTNAME + '","' + aa[i].PROJECTNO + '","' + aa[i].PRJDEPTNAME + '","' + aa[i].PRJTYPE + '","' + aa[i].PROJECTID + '","' + aa[i].PMID + '")')
    }
    tx.executeSql('SELECT * FROM PMBASE_PRJFORINSPECT', [], (tx, result) => {
      //   console.log(result)
    })
  }, (err) => {
    console.log('错误', err)
  })
};
// 创建安全检查单表
export function createHSEinspectioninfo() {
  store.state.SQLiteDB.transaction((tx) => {
    tx.executeSql('CREATE TABLE IF NOT EXISTS PMHSE_INSPECTION (GUID unique, RESTATE, PRODEPT, PROJECTID, CONSTRUCTPRO, SYSPRJID, CENTERPOSITION, CHECKDATE, CHECKMONTH, CHECKYEAR ,CHECKMY,FATHERCLASS_TEXT,FATHERCLASS,CHECKPRO_TEXT,CHECKPRO,CHECKQUARTER,CHECKITEMS_TEXT,CHECKITEMS,SECURITYLEVEL,CHILDCLASS,IMPORTANCE,WEIGHT,SYSTODAY,DESCRIPTION,HIDDENNUM,PROSCORE,ACTSCORE,ATTACHMENTS,INPUTERFULLNAME,INPUTERNAME,PHONENUM,INPUTERDEPTNAME,INPUTDATE,FILEURL,ISREPLY)');

    // tx.executeSql('INSERT INTO PMHSE_INSPECTION (GUID , RESTATE, PROJECTID, CONSTRUCTPRO, SYSPRJID, CENTERPOSITION, CHECKDATE, CHECKMONTH, CHECKYEAR ,CHECKMY,FATHERCLASS_TEXT,FATHERCLASS,CHECKPRO_TEXT,CHECKPRO,CHECKQUARTER,CHECKITEMS_TEXT,CHECKITEMS,SECURITYLEVEL,CHILDCLASS,IMPORTANCE,WEIGHT,SYSTODAY,DESCRIPTION,HIDDENNUM,PROSCORE,ACTSCORE,ATTACHMENTS,INPUTERFULLNAME,PHONENUM,INPUTERDEPTNAME,INPUTDATE,FILEURL,INPUTERNAME,PRODEPT) VALUES ("3","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1")')
    //tx.executeSql('INSERT INTO PMBASE_PRJFORINSPECT (GUID, RESTATE, CONSTRUCTPRO, SYSPRJID, CENTERPOSITION, CHECKDATE, CHECKMONTH, CHECKYEAR ,CHECKMY,FATHERCLASS_TEXT,FATHERCLASS,CHECKPRO_TEXT,CHECKPRO,CHECKQUARTER,CHECKITEMS_TEXT,CHECKITEMS,SECURITYLEVEL,CHILDCLASS,IMPORTANCE,WEIGHT,SYSTODAY,DESCRIPTION,HIDDENNUM,PROSCORE,ACTSCORE,ATTACHMENTS,INPUTERFULLNAME,PHONENUM,INPUTERDEPTNAME,INPUTDATE) VALUES ('+i+', "'+aa[i].PMNAME+'", "'+aa[i].RELATEID+'", "'+aa[i].PROJECTNAME+'","'+aa[i].PROJECTNO+'","'+aa[i].PRJDEPTNAME+'","'+aa[i].PRJTYPE+'","'+aa[i].PROJECTID+'","'+aa[i].PMID+'")')

    // tx.executeSql('SELECT * FROM PMBASE_PRJFORINSPECT', [],(tx,result)=>{
    //     console.log(result)
    // })   
  }, (err) => {
    console.log('错误', err)
  })
};
// 创建安全巡检表
export function createHSEcheckLIST() {
  store.state.SQLiteDB.transaction((tx) => {
    tx.executeSql('CREATE TABLE IF NOT EXISTS PMHSE_CHECKLIST (GUID unique,  STATE, ATTACHMENTS, ATTACHMENTS2, PRJNAME, PRJNO, SYSPRJID, SUBJECT ,CHECKREQUIRED,PLANDATE,FINISHDATE,DESCRIPTION,INPUTERFULLNAME,INPUTERNAME,INPUTERDEPTNAME,INPUTERDEPTID,PHONENUM,INPUTDATE,NOTIFYCHECK,NOTIFYMETHOD,REFORMER,REFORMERID,FLAG,CHECKER,INSPECTMEMBERFULLNAME,INSPECTMEMBERNAME,CHECKERID,FILEURL,SUPERVISORFULLNAME,SUPERVISORNAME)');

    //tx.executeSql('INSERT INTO PMBASE_PRJFORINSPECT (GUID, RESTATE, CONSTRUCTPRO, SYSPRJID, CENTERPOSITION, CHECKDATE, CHECKMONTH, CHECKYEAR ,CHECKMY,FATHERCLASS_TEXT,FATHERCLASS,CHECKPRO_TEXT,CHECKPRO,CHECKQUARTER,CHECKITEMS_TEXT,CHECKITEMS,SECURITYLEVEL,CHILDCLASS,IMPORTANCE,WEIGHT,SYSTODAY,DESCRIPTION,HIDDENNUM,PROSCORE,ACTSCORE,ATTACHMENTS,INPUTERFULLNAME,PHONENUM,INPUTERDEPTNAME,INPUTDATE) VALUES ('+i+', "'+aa[i].PMNAME+'", "'+aa[i].RELATEID+'", "'+aa[i].PROJECTNAME+'","'+aa[i].PROJECTNO+'","'+aa[i].PRJDEPTNAME+'","'+aa[i].PRJTYPE+'","'+aa[i].PROJECTID+'","'+aa[i].PMID+'")')

    // tx.executeSql('SELECT * FROM PMBASE_PRJFORINSPECT', [],(tx,result)=>{
    //     console.log(result)
    // })   
  }, (err) => {
    console.log('错误', err)
  })
};
// 创建用户信息表
export function createUSERINFO(aa) {
  console.log("创建用户信息表");
  store.state.SQLiteDB.transaction((tx) => {
    tx.executeSql('DROP TABLE IF EXISTS FIX_USERINFO');
    tx.executeSql('CREATE TABLE IF NOT EXISTS FIX_USERINFO (ID unique, USER_ID, USER_NAME, PASSWORD, USER_FULLNAME, ADUSER_NAME, USER_NO, IS_ADMIN ,IS_FORMAL,PASSWORD_OVERDUE,EMAIL,CREATE_DT,UPDATE_DT,CREATE_BY,UPDATE_BY,STATUS,UserIcon,SignatureImg)');
    for (let i = 0; i < aa.length; i++) {
      tx.executeSql('INSERT INTO FIX_USERINFO (ID, USER_ID, USER_NAME, PASSWORD, USER_FULLNAME, ADUSER_NAME, USER_NO, IS_ADMIN ,IS_FORMAL,PASSWORD_OVERDUE,EMAIL,CREATE_DT,UPDATE_DT,CREATE_BY,UPDATE_BY,STATUS,UserIcon,SignatureImg) VALUES ("' + guid() + '", "' + aa[i].USER_ID + '", "' + aa[i].USER_NAME + '", "' + aa[i].PASSWORD + '","' + aa[i].USER_FULLNAME + '","' + aa[i].ADUSER_NAME + '","' + aa[i].USER_NO + '","' + aa[i].IS_ADMIN + '","' + aa[i].IS_FORMAL + '","' + aa[i].PASSWORD_OVERDUE + '","' + aa[i].EMAIL + '","' + aa[i].CREATE_DT + '","' + aa[i].UPDATE_DT + '","' + aa[i].CREATE_BY + '","' + aa[i].UPDATE_BY + '","' + aa[i].STATUS + '","' + aa[i].UserIcon + '","' + aa[i].SignatureImg + '")')
    }
    // tx.executeSql('SELECT * FROM PMBASE_PRJFORINSPECT', [],(tx,result)=>{
    //     console.log('用户信息',result)
    // })   
  }, (err) => {
    console.log('创建用户信息表', err)
  })
};
// 创建SYS项目信息表
export function createSYS_PROJECTINFO(aa) {
  store.state.SQLiteDB.transaction((tx) => {
    tx.executeSql('DROP TABLE IF EXISTS SYS_PROJECTINFO');
    tx.executeSql('CREATE TABLE IF NOT EXISTS SYS_PROJECTINFO (ID unique,PROJECTID, PROJECTNO, PROJECTNAME,STATE, CREATEDATE, CREATEUSERNAME , CREATEUSERFULLNAME, PRJADMINNAME, PRJADMINFULLNAME, SORTID, PRJNO, PRJCODE, PRJPHASENAME, PRJDEPTID, PRJDEPTNAME, ISDELETE, PRJSCALE, PRJCATEGORY, PRJMANAGER, PRJMANAGERFULLNAME, STARTDATE, FINISHDATE, LIMITDAYS, PRJTYPE, PRJPLACE, OWNER, CUSFAX, CONTRACTTYPE, ISPRJMANAG,  REMARK, ATTACHMENT, PICATTACHMENT, ISFOREGINCURRENCY, PURCHASEENGINEERID, PURCHASEENGINEER, CONTRACTENGINEERID, CONTRACTENGINEER, OWNERID, ATTACHMENT2, ISDEAL, ISPURCHASE,  ISMONEYINOUT, CONTNO, CONTNAME, INNERHTML, OUTHTML, BELONG_SYSTEM, GUID, INITIALSENDINFO,PRJBDST, BLOCKNAME, BLOCKDESCRIPT, POSTION, CENTERPOSTION, USETYPE, CONTRACTSUM, PRJMANAGERPHONE, ASSISTFULLNAME, ASSISTNAME, ASSISTPHONE)');
    for (let i = 0; i < aa.length; i++) {
      tx.executeSql('INSERT INTO SYS_PROJECTINFO (ID ,PROJECTID, PROJECTNO, PROJECTNAME,STATE, CREATEDATE, CREATEUSERNAME , CREATEUSERFULLNAME, PRJADMINNAME, PRJADMINFULLNAME, SORTID, PRJNO, PRJCODE, PRJPHASENAME, PRJDEPTID, PRJDEPTNAME, ISDELETE, PRJSCALE, PRJCATEGORY, PRJMANAGER, PRJMANAGERFULLNAME, STARTDATE, FINISHDATE, LIMITDAYS, PRJTYPE, PRJPLACE, OWNER, CUSFAX, CONTRACTTYPE, ISPRJMANAG, REMARK, ATTACHMENT, PICATTACHMENT, ISFOREGINCURRENCY, PURCHASEENGINEERID, PURCHASEENGINEER, CONTRACTENGINEERID, CONTRACTENGINEER, OWNERID, ATTACHMENT2, ISDEAL, ISPURCHASE, ISMONEYINOUT, CONTNO, CONTNAME, INNERHTML, OUTHTML, BELONG_SYSTEM, GUID, INITIALSENDINFO,PRJBDST, BLOCKNAME, BLOCKDESCRIPT, POSTION, CENTERPOSTION, USETYPE, CONTRACTSUM, PRJMANAGERPHONE, ASSISTFULLNAME, ASSISTNAME, ASSISTPHONE) VALUES ("' + guid() + '", "' + aa[i].PROJECTID + '", "' + aa[i].PROJECTNO + '", "' + aa[i].PROJECTNAME + '","' + aa[i].STATE + '","' + aa[i].CREATEDATE + '","' + aa[i].CREATEUSERNAME + '","' + aa[i].CREATEUSERFULLNAME + '","' + aa[i].PRJADMINNAME + '","' + aa[i].PRJADMINFULLNAME + '","' + aa[i].SORTID + '","' + aa[i].PRJNO + '","' + aa[i].PRJCODE + '","' + aa[i].PRJPHASENAME + '","' + aa[i].PRJDEPTID + '","' + aa[i].PRJDEPTNAME + '","' + aa[i].ISDELETE + '","' + aa[i].PRJSCALE + '","' + aa[i].PRJCATEGORY + '","' + aa[i].PRJMANAGER + '","' + aa[i].PRJMANAGERFULLNAME + '","' + aa[i].STARTDATE + '","' + aa[i].FINISHDATE + '","' + aa[i].LIMITDAYS + '","' + aa[i].PRJTYPE + '","' + aa[i].PRJPLACE + '","' + aa[i].OWNER + '","' + aa[i].CUSFAX + '","' + aa[i].CONTRACTTYPE + '","' + aa[i].ISPRJMANAG + '","' + aa[i].REMARK + '","' + aa[i].ATTACHMENT + '","' + aa[i].PICATTACHMENT + '","' + aa[i].ISFOREGINCURRENCY + '","' + aa[i].PURCHASEENGINEERID + '","' + aa[i].PURCHASEENGINEER + '","' + aa[i].CONTRACTENGINEERID + '","' + aa[i].CONTRACTENGINEER + '","' + aa[i].OWNERID + '","' + aa[i].ATTACHMENT2 + '","' + aa[i].ISDEAL + '","' + aa[i].ISPURCHASE + '","' + aa[i].ISMONEYINOUT + '","' + aa[i].CONTNO + '","' + aa[i].CONTNAME + '","' + aa[i].INNERHTML + '","' + aa[i].OUTHTML + '","' + aa[i].BELONG_SYSTEM + '","' + aa[i].GUID + '","' + aa[i].INITIALSENDINFO + '","' + aa[i].PRJBDST + '","' + aa[i].BLOCKNAME + '","' + aa[i].BLOCKDESCRIPT + '","' + aa[i].POSTION + '","' + aa[i].CENTERPOSTION + '","' + aa[i].USETYPE + '","' + aa[i].CONTRACTSUM + '","' + aa[i].PRJMANAGERPHONE + '","' + aa[i].ASSISTFULLNAME + '","' + aa[i].ASSISTNAME + '","' + aa[i].ASSISTPHONE + '")')
    }
      
  }, (err) => {
    console.log('创建SYS项目信息表', err)
  })
  // var database;
  // database = new sqlite3.Database("mydatebase.db", function(e){
  //   if (err) throw err;
  // });
  // database.run('CREATE TABLE IF NOT EXISTS SYS_PROJECTINFO (ID unique,PROJECTID, PROJECTNO, PROJECTNAME,STATE, CREATEDATE, CREATEUSERNAME , CREATEUSERFULLNAME, PRJADMINNAME, PRJADMINFULLNAME, SORTID, PRJNO, PRJCODE, PRJPHASENAME, PRJDEPTID, PRJDEPTNAME, ISDELETE, PRJSCALE, PRJCATEGORY, PRJMANAGER, PRJMANAGERFULLNAME, STARTDATE, FINISHDATE, LIMITDAYS, PRJTYPE, PRJPLACE, OWNER, CUSFAX, CONTRACTTYPE, ISPRJMANAG, TARGET, REMARK, ATTACHMENT, PICATTACHMENT, ISFOREGINCURRENCY, PURCHASEENGINEERID, PURCHASEENGINEER, CONTRACTENGINEERID, CONTRACTENGINEER, OWNERID, ATTACHMENT2, ISDEAL, ISPURCHASE,  ISMONEYINOUT, CONTNO, CONTNAME, INNERHTML, OUTHTML, BELONG_SYSTEM, GUID, INITIALSENDINFO,PRJBDST, BLOCKNAME, BLOCKDESCRIPT, POSTION, CENTERPOSTION, USETYPE, CONTRACTSUM, PRJMANAGERPHONE, ASSISTFULLNAME, ASSISTNAME, ASSISTPHONE)')
  // for (let i = 0; i < aa.length; i++) {
  //   database.run('INSERT INTO SYS_PROJECTINFO (ID ,PROJECTID, PROJECTNO, PROJECTNAME,STATE, CREATEDATE, CREATEUSERNAME , CREATEUSERFULLNAME, PRJADMINNAME, PRJADMINFULLNAME, SORTID, PRJNO, PRJCODE, PRJPHASENAME, PRJDEPTID, PRJDEPTNAME, ISDELETE, PRJSCALE, PRJCATEGORY, PRJMANAGER, PRJMANAGERFULLNAME, STARTDATE, FINISHDATE, LIMITDAYS, PRJTYPE, PRJPLACE, OWNER, CUSFAX, CONTRACTTYPE, ISPRJMANAG, TARGET, REMARK, ATTACHMENT, PICATTACHMENT, ISFOREGINCURRENCY, PURCHASEENGINEERID, PURCHASEENGINEER, CONTRACTENGINEERID, CONTRACTENGINEER, OWNERID, ATTACHMENT2, ISDEAL, ISPURCHASE, ISMONEYINOUT, CONTNO, CONTNAME, INNERHTML, OUTHTML, BELONG_SYSTEM, GUID, INITIALSENDINFO,PRJBDST, BLOCKNAME, BLOCKDESCRIPT, POSTION, CENTERPOSTION, USETYPE, CONTRACTSUM, PRJMANAGERPHONE, ASSISTFULLNAME, ASSISTNAME, ASSISTPHONE) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)',guid(),aa[i].PROJECTID,aa[i].PROJECTNO,aa[i].PROJECTNAME,aa[i].STATE,aa[i].CREATEDATE,aa[i].CREATEUSERNAME,aa[i].CREATEUSERFULLNAME,aa[i].PRJADMINNAME,aa[i].PRJADMINFULLNAME,aa[i].SORTID,aa[i].PRJNO,aa[i].PRJCODE,aa[i].PRJPHASENAME,aa[i].PRJDEPTID,aa[i].PRJDEPTNAME,aa[i].ISDELETE,aa[i].PRJSCALE,aa[i].PRJCATEGORY,aa[i].PRJMANAGER,aa[i].PRJMANAGERFULLNAME,aa[i].STARTDATE,aa[i].FINISHDATE,aa[i].LIMITDAYS,aa[i].PRJTYPE,aa[i].PRJPLACE,aa[i].OWNER,aa[i].CUSFAX , aa[i].CONTRACTTYPE , aa[i].ISPRJMANAG , aa[i].TARGET ,aa[i].REMARK , aa[i].ATTACHMENT , aa[i].PICATTACHMENT , aa[i].ISFOREGINCURRENCY , aa[i].PURCHASEENGINEERID , aa[i].PURCHASEENGINEER , aa[i].CONTRACTENGINEERID , aa[i].CONTRACTENGINEER , aa[i].OWNERID , aa[i].ATTACHMENT2 , aa[i].ISDEAL , aa[i].ISPURCHASE , aa[i].ISMONEYINOUT , aa[i].CONTNO , aa[i].CONTNAME , aa[i].INNERHTML , aa[i].OUTHTML , aa[i].BELONG_SYSTEM , aa[i].GUID ,aa[i].INITIALSENDINFO , aa[i].PRJBDST , aa[i].BLOCKNAME , aa[i].BLOCKDESCRIPT , aa[i].POSTION , aa[i].CENTERPOSTION , aa[i].USETYPE , aa[i].CONTRACTSUM , aa[i].PRJMANAGERPHONE , aa[i].ASSISTFULLNAME , aa[i].ASSISTNAME , aa[i].ASSISTPHONE)
  // }
};
// 创建PERBASEDATA表
export function createPERBASEDATA(aa) {
  store.state.SQLiteDB.transaction((tx) => {
    tx.executeSql('DROP TABLE IF EXISTS PERBASEDATA');
    tx.executeSql('CREATE TABLE IF NOT EXISTS PERBASEDATA (ID unique,ADD_MAIL, ADUSERCN, AGES,ARCHIVES, BIRTH_AREA, BIRTH_DAY, DESCRIPTION ,DUTY_COMPETENCE,DUTY_NAME,FIRST_DEPTNAME,FLAG,FORTH_DEPTNAME,GO_ABROAD,GROUPPATHID,GROUPPATHNAME,GUID,HEADCOUNT,ID_CARD,INFO_AFTERJOIN,INFO_DURINGCHECKING,INPUTDATE,INPUTERUSERNAME,ISACTIVE,ISDELETE,JOIN_TIME,LABOR_CONTRACT,LANGUAGE,LEADER_GRADE,LEAVE_TIME,LIFEROOM,MARRIAGE_STATES,NATION,NATIVE_PLACE,OLDID,ORG,ORGPATHNAME,ORGPHOTO,ORG_WORK_STATUS,PASSPORT,PASSWORD,PEOPLES,PERMISSION,PERMISSIONID,PHOTO,PKID,POLITICS,POST_GRADE,POST_NAME,POST_ROLE,POST_TYPE,PROFESSION_NAME,PROF_CONTENT,PROJECTID,PUNISHMENT,REWARDS,SALARY_GRADE,SECOND_DEPTNAME,SEX,SIGNATURE,SIGNATUREFILES,SIGNATUREIMG,SOCIAL_SECURITY,SPECIALGROUPPATHID,SPECIALGROUPPATHNAME,STUDY_DEGREE,STUDY_EXPERIENCE,TECH_GRADE,TELEPHONE_CODE,THIRD_DEPTNAME,TITLE_NAME,TRAIN,TRUSTEESHIP_DEPARTMENT,USER_FULLNAME,USER_NAME,USER_NO,USER_OLDNAME,VIRTUALPATHID,VIRTUALPATHNAME,WORK_STATUS,WORK_STATUS_MAIL,WORK_STYLE,WORK_TIME,YEAR_CHECKWORK)');
    for (let i = 0; i < aa.length; i++) {
      tx.executeSql('INSERT INTO PERBASEDATA (ID,ADD_MAIL, ADUSERCN, AGES,ARCHIVES, BIRTH_AREA, BIRTH_DAY, DESCRIPTION ,DUTY_COMPETENCE,DUTY_NAME,FIRST_DEPTNAME,FLAG,FORTH_DEPTNAME,GO_ABROAD,GROUPPATHID,GROUPPATHNAME,GUID,HEADCOUNT,ID_CARD,INFO_AFTERJOIN,INFO_DURINGCHECKING,INPUTDATE,INPUTERUSERNAME,ISACTIVE,ISDELETE,JOIN_TIME,LABOR_CONTRACT,LANGUAGE,LEADER_GRADE,LEAVE_TIME,LIFEROOM,MARRIAGE_STATES,NATION,NATIVE_PLACE,OLDID,ORG,ORGPATHNAME,ORGPHOTO,ORG_WORK_STATUS,PASSPORT,PASSWORD,PEOPLES,PERMISSION,PERMISSIONID,PHOTO,PKID,POLITICS,POST_GRADE,POST_NAME,POST_ROLE,POST_TYPE,PROFESSION_NAME,PROF_CONTENT,PROJECTID,PUNISHMENT,REWARDS,SALARY_GRADE,SECOND_DEPTNAME,SEX,SIGNATURE,SIGNATUREFILES,SIGNATUREIMG,SOCIAL_SECURITY,SPECIALGROUPPATHID,SPECIALGROUPPATHNAME,STUDY_DEGREE,STUDY_EXPERIENCE,TECH_GRADE,TELEPHONE_CODE,THIRD_DEPTNAME,TITLE_NAME,TRAIN,TRUSTEESHIP_DEPARTMENT,USER_FULLNAME,USER_NAME,USER_NO,USER_OLDNAME,VIRTUALPATHID,VIRTUALPATHNAME,WORK_STATUS,WORK_STATUS_MAIL,WORK_STYLE,WORK_TIME,YEAR_CHECKWORK) VALUES ("' + guid() + '","' + aa[i].ADD_MAIL + '","' + aa[i].ADUSERCN + '","' + aa[i].AGES + '","' + aa[i].ARCHIVES + '","' + aa[i].BIRTH_AREA + '","' + aa[i].BIRTH_DAY + '","' + aa[i].DESCRIPTION + '","' + aa[i].DUTY_COMPETENCE + '","' + aa[i].DUTY_NAME + '","' + aa[i].FIRST_DEPTNAME + '","' + aa[i].FLAG + '","' + aa[i].FORTH_DEPTNAME + '","' + aa[i].GO_ABROAD + '","' + aa[i].GROUPPATHID + '","' + aa[i].GROUPPATHNAME + '","' + aa[i].GUID + '","' + aa[i].HEADCOUNT + '","' + aa[i].ID_CARD + '","' + aa[i].INFO_AFTERJOIN + '","' + aa[i].INFO_DURINGCHECKING + '","' + aa[i].INPUTDATE + '","' + aa[i].INPUTERUSERNAME + '","' + aa[i].ISACTIVE + '","' + aa[i].ISDELETE + '","' + aa[i].JOIN_TIME + '","' + aa[i].LABOR_CONTRACT + '","' + aa[i].LANGUAGE + '","' + aa[i].LEADER_GRADE + '","' + aa[i].LEAVE_TIME + '","' + aa[i].LIFEROOM + '","' + aa[i].MARRIAGE_STATES + '","' + aa[i].NATION + '","' + aa[i].NATIVE_PLACE + '","' + aa[i].OLDID + '","' + aa[i].ORG + '","' + aa[i].ORGPATHNAME + '","' + aa[i].ORGPHOTO + '","' + aa[i].ORG_WORK_STATUS + '","' + aa[i].PASSPORT + '","' + aa[i].PASSWORD + '","' + aa[i].PEOPLES + '","' + aa[i].PERMISSION + '","' + aa[i].PERMISSIONID + '","' + aa[i].PHOTO + '","' + aa[i].PKID + '","' + aa[i].POLITICS + '","' + aa[i].POST_GRADE + '","' + aa[i].POST_NAME + '","' + aa[i].POST_ROLE + '","' + aa[i].POST_TYPE + '","' + aa[i].PROFESSION_NAME + '","' + aa[i].PROF_CONTENT + '","' + aa[i].PROJECTID + '","' + aa[i].PUNISHMENT + '","' + aa[i].REWARDS + '","' + aa[i].SALARY_GRADE + '","' + aa[i].SECOND_DEPTNAME + '","' + aa[i].SEX + '","' + aa[i].SIGNATURE + '","' + aa[i].SIGNATUREFILES + '","' + aa[i].SIGNATUREIMG + '","' + aa[i].SOCIAL_SECURITY + '","' + aa[i].SPECIALGROUPPATHID + '","' + aa[i].SPECIALGROUPPATHNAME + '","' + aa[i].STUDY_DEGREE + '","' + aa[i].STUDY_EXPERIENCE + '","' + aa[i].TECH_GRADE + '","' + aa[i].TELEPHONE_CODE + '","' + aa[i].THIRD_DEPTNAME + '","' + aa[i].TITLE_NAME + '","' + aa[i].TRAIN + '","' + aa[i].TRUSTEESHIP_DEPARTMENT + '","' + aa[i].USER_FULLNAME + '","' + aa[i].USER_NAME + '","' + aa[i].USER_NO + '","' + aa[i].USER_OLDNAME + '","' + aa[i].VIRTUALPATHID + '","' + aa[i].VIRTUALPATHNAME + '","' + aa[i].WORK_STATUS + '","' + aa[i].WORK_STATUS_MAIL + '","' + aa[i].WORK_STYLE + '","' + aa[i].WORK_TIME + '","' + aa[i].YEAR_CHECKWORK + '")')
    }
    // tx.executeSql('SELECT * FROM PMBASE_PRJFORINSPECT', [],(tx,result)=>{
    //     console.log(result)
    // })   
  }, (err) => {
    console.log('创建PERBASEDATA表', err)
  })
};
// 创建人员选择表
export function createUSERSELECTINFO(aa) {
  store.state.SQLiteDB.transaction((tx) => {
    tx.executeSql('DROP TABLE IF EXISTS USERSELECTINFO');
    tx.executeSql('CREATE TABLE IF NOT EXISTS USERSELECTINFO (ID unique,AGES, ARCHIVES, BIRTH_AREA,BIRTH_DAY, DESCRIPTION, DUTY_COMPETENCE, DUTY_NAME ,FIRSTDEPTNAME,GO_ABROAD,GROUPPATHID,GROUPPATHNAME,GUID,HEADCOUNT,ID_CARD,JOIN_TIME,LABOR_CONTRACT,LANGUAGE,LEADER_GRADE,LIFEROOM,MARRIAGE_STATES,NATION,NATIVE_PLACE,ORG_ID,ORG_NAME,ORG_PATHID,ORG_PATHNAME,PASSPORT,PEOPLES,POLITICS,POST_GRADE,POST_NAME,POST_ROLE,POST_TYPE,PRJID,PROFESSION_NAME,PROF_CONTENT,PUNISHMENT,REWARDS,SALARY_GRADE,SECONDDEPTNAME,SEX,SIGNATURE,SOCIAL_SECURITY,SPECIALGROUPPATHID,SPECIALGROUPPATHNAME,STUDY_DEGREE,STUDY_EXPERIENCE,TECH_GRADE,TELEPHONE_CODE,THIRDDEPTNAME,TITLE_NAME,TRAIN,TRUSTEESHIP_DEPARTMENT,UNITID,USERGUID,USER_FULLNAME,USER_NAME,USER_NO,USER_OLDNAME,VIRTUALPATHID,VIRTUALPATHNAME,WORK_STATUS,WORK_STYLE,WORK_TIME,YEAR_CHECKWORK)');
    for (let i = 0; i < aa.length; i++) {
      tx.executeSql('INSERT INTO USERSELECTINFO (ID,AGES, ARCHIVES, BIRTH_AREA,BIRTH_DAY, DESCRIPTION, DUTY_COMPETENCE, DUTY_NAME ,FIRSTDEPTNAME,GO_ABROAD,GROUPPATHID,GROUPPATHNAME,GUID,HEADCOUNT,ID_CARD,JOIN_TIME,LABOR_CONTRACT,LANGUAGE,LEADER_GRADE,LIFEROOM,MARRIAGE_STATES,NATION,NATIVE_PLACE,ORG_ID,ORG_NAME,ORG_PATHID,ORG_PATHNAME,PASSPORT,PEOPLES,POLITICS,POST_GRADE,POST_NAME,POST_ROLE,POST_TYPE,PRJID,PROFESSION_NAME,PROF_CONTENT,PUNISHMENT,REWARDS,SALARY_GRADE,SECONDDEPTNAME,SEX,SIGNATURE,SOCIAL_SECURITY,SPECIALGROUPPATHID,SPECIALGROUPPATHNAME,STUDY_DEGREE,STUDY_EXPERIENCE,TECH_GRADE,TELEPHONE_CODE,THIRDDEPTNAME,TITLE_NAME,TRAIN,TRUSTEESHIP_DEPARTMENT,UNITID,USERGUID,USER_FULLNAME,USER_NAME,USER_NO,USER_OLDNAME,VIRTUALPATHID,VIRTUALPATHNAME,WORK_STATUS,WORK_STYLE,WORK_TIME,YEAR_CHECKWORK) VALUES ("' + guid() + '", "' + aa[i].AGES + '", "' + aa[i].ARCHIVES + '", "' + aa[i].BIRTH_AREA + '","' + aa[i].BIRTH_DAY + '","' + aa[i].DESCRIPTION + '","' + aa[i].DUTY_COMPETENCE + '","' + aa[i].DUTY_NAME + '","' + aa[i].FIRSTDEPTNAME + '","' + aa[i].GO_ABROAD + '","' + aa[i].GROUPPATHID + '","' + aa[i].GROUPPATHNAME + '","' + aa[i].GUID + '","' + aa[i].HEADCOUNT + '","' + aa[i].ID_CARD + '","' + aa[i].JOIN_TIME + '","' + aa[i].LABOR_CONTRACT + '","' + aa[i].LANGUAGE + '","' + aa[i].LEADER_GRADE + '","' + aa[i].LIFEROOM + '","' + aa[i].MARRIAGE_STATES + '","' + aa[i].NATION + '","' + aa[i].NATIVE_PLACE + '","' + aa[i].ORG_ID + '","' + aa[i].ORG_NAME + '","' + aa[i].ORG_PATHID + '","' + aa[i].ORG_PATHNAME + '","' + aa[i].PASSPORT + '","' + aa[i].PEOPLES + '","' + aa[i].POLITICS + '","' + aa[i].POST_GRADE + '","' + aa[i].POST_NAME + '","' + aa[i].POST_ROLE + '","' + aa[i].POST_TYPE + '","' + aa[i].PRJID + '","' + aa[i].PROFESSION_NAME + '","' + aa[i].PROF_CONTENT + '","' + aa[i].PUNISHMENT + '","' + aa[i].REWARDS + '","' + aa[i].SALARY_GRADE + '","' + aa[i].SECONDDEPTNAME + '","' + aa[i].SEX + '","' + aa[i].SIGNATURE + '","' + aa[i].SOCIAL_SECURITY + '","' + aa[i].SPECIALGROUPPATHID + '","' + aa[i].SPECIALGROUPPATHNAME + '","' + aa[i].STUDY_DEGREE + '","' + aa[i].STUDY_EXPERIENCE + '","' + aa[i].TECH_GRADE + '","' + aa[i].TELEPHONE_CODE + '","' + aa[i].THIRDDEPTNAME + '","' + aa[i].TITLE_NAME + '","' + aa[i].TRAIN + '","' + aa[i].TRUSTEESHIP_DEPARTMENT + '","' + aa[i].UNITID + '","' + aa[i].USERGUID + '","' + aa[i].USER_FULLNAME + '","' + aa[i].USER_NAME + '","' + aa[i].USER_NO + '","' + aa[i].USER_OLDNAME + '","' + aa[i].VIRTUALPATHID + '","' + aa[i].VIRTUALPATHNAME + '","' + aa[i].WORK_STATUS + '","' + aa[i].WORK_STYLE + '","' + aa[i].WORK_TIME + '","' + aa[i].YEAR_CHECKWORK + '")')
    }
    // tx.executeSql('SELECT * FROM PMBASE_PRJFORINSPECT', [],(tx,result)=>{
    //     console.log(result)
    // })   
  }, (err) => {
    console.log('创建人员选择表', err)
  })
};
//创建质量检查表类型表
export function createQualityCheckType(data) {
  store.state.SQLiteDB.transaction((tx) => {
    tx.executeSql('DROP TABLE IF EXISTS PMQUALITY_CHECKTYPE');
    tx.executeSql('CREATE TABLE IF NOT EXISTS PMQUALITY_CHECKTYPE(id unique, CODE_NAME, CODE_ID)');
    for (let i = 0; i < data.length; i++) {
      tx.executeSql('INSERT INTO PMQUALITY_CHECKTYPE (id, CODE_NAME, CODE_ID) VALUES ("' + guid() + '","' + data[i].CODE_NAME + '","' + data[i].CODE_ID + '")')
    }
  }, (err) => {
    console.log('错误', err)
  })
};
//创建质量检查项表
export function createQualityCheckItem(data) {
  store.state.SQLiteDB.transaction((tx) => {
    tx.executeSql('DROP TABLE IF EXISTS PMQUALITY_CHECKITEM');
    tx.executeSql('CREATE TABLE IF NOT EXISTS PMQUALITY_CHECKITEM(id unique, INSPECTITEM, INSPECTTYPE)');
    for (let i = 0; i < data.length; i++) {
      tx.executeSql('INSERT INTO PMQUALITY_CHECKITEM (id, INSPECTITEM, INSPECTTYPE) VALUES ("' + guid() + '","' + data[i].INSPECTITEM + '","' + data[i].INSPECTTYPE + '")')
    }
  }, (err) => {
    console.log('错误', err)
  })
};
//创建质量检查子项表
export function createQualityCheckChilds(data){
  store.state.SQLiteDB.transaction((tx) => {
    tx.executeSql('DROP TABLE IF EXISTS PMQUALITY_CHECKCHILDS');
    tx.executeSql('CREATE TABLE IF NOT EXISTS PMQUALITY_CHECKCHILDS(id unique, INSPECTITEM, CHILDINSPECTITEM, FORMTYPE)');
    for (let i = 0; i < data.length; i++) {
      tx.executeSql('INSERT INTO PMQUALITY_CHECKCHILDS (id, INSPECTITEM, CHILDINSPECTITEM,FORMTYPE) VALUES ("' + guid() + '","' + data[i].INSPECTITEM + '","' + data[i].CHILDINSPECTITEM + '","' + data[i].FORMTYPE + '")')
    }
  }, (err) => {
    console.log('错误', err)
  })
}
//创建质量检查单表
export function createQualityInspection() {
  store.state.SQLiteDB.transaction((tx) => {
    tx.executeSql('CREATE TABLE IF NOT EXISTS PMQUALITY_INSPECTION (GUID unique, FLAG, CENTERPOSITION, FORMNAME, FORMNO, PRJNAME, SYSPRJID, UNITNAME ,UNITID,CHECKDATE,CHECKYEAR,CHECKMONTH,CHECKYEARANDMONTH,CHECKTYPE,DESCRIPTION,ATTACHMENTS,INPUTERFULLNAME,INPUTERNAME,PHONENUM,INPUTERDEPTNAME,INPUTERDEPTID,INPUTDATE,PROJECTNAME,PROJECTID,CHECKITEM,FILEURL,TYPE,TYPEORDERID,ISTHIRDPART,CHECKQUARTER)');
  }, (err) => {
    console.log('错误', err)
  })
};
//创建PRJMOBILEAPP_R_M_CONFIG表
export function createPRJMOBILEAPP_R_M_CONFIG(data) {
  store.state.SQLiteDB.transaction((tx) => {
    tx.executeSql('DROP TABLE IF EXISTS PRJMOBILEAPP_R_M_CONFIG');
    tx.executeSql('CREATE TABLE IF NOT EXISTS PRJMOBILEAPP_R_M_CONFIG(id unique,ROLEID,APPID,GUID,APPNAME,PROJECTID,CREATEDTIME,MODIFYTIME)');
    for (let i = 0; i < data.length; i++) {
      tx.executeSql('INSERT INTO PRJMOBILEAPP_R_M_CONFIG (id, ROLEID, APPID, GUID, APPNAME, PROJECTID, CREATEDTIME,MODIFYTIME) VALUES ("' + guid() + '","' + data[i].ROLEID + '","' + data[i].APPID + '","' + data[i].GUID + '","' + data[i].APPNAME + '","' + data[i].PROJECTID + '","' + data[i].CREATEDTIME + '","' + data[i].MODIFYTIME + '")')
    }
  })
};
//创建PMBASE_PRJMANAG_DETAIL表
export function createPMBASE_PRJMANAG_DETAIL(data) {
  store.state.SQLiteDB.transaction((tx) => {
    tx.executeSql('DROP TABLE IF EXISTS PMBASE_PRJMANAG_DETAIL');
    tx.executeSql('CREATE TABLE IF NOT EXISTS PMBASE_PRJMANAG_DETAIL(id unique,GUID,RELATEID,PROJECTNAME,PROJECTNO,PRJDEPTNAME,PRJTYPE,PROJECTID,STARTDATE,FINISHDATE,PRJCODE,PRJSHORT,CONTRACTSUM,PRJBDST,PRJCATEGORY,PRJMANAGERFULLNAME,BLOCKNAME,POSITION,BLOCKCENTER)');
    for (let i = 0; i < data.length; i++) {
      tx.executeSql('INSERT INTO PMBASE_PRJMANAG_DETAIL(id,GUID,RELATEID,PROJECTNAME,PROJECTNO,PRJDEPTNAME,PRJTYPE,PROJECTID,STARTDATE,FINISHDATE,PRJCODE,PRJSHORT,CONTRACTSUM,PRJBDST,PRJCATEGORY,PRJMANAGERFULLNAME,BLOCKNAME,POSITION,BLOCKCENTER) ' +
        'VALUES ("' + guid() + '","' + data[i].GUID + '","' + data[i].RELATEID + '","' + data[i].PROJECTNAME + '","' + data[i].PROJECTNO + '","' + data[i].PRJDEPTNAME + '","' + data[i].PRJTYPE + '","' + data[i].PROJECTID + '","' + data[i].STARTDATE + '","' + data[i].FINISHDATE + '","' + data[i].PRJCODE + '","' + data[i].PRJSHORT + '","' + data[i].CONTRACTSUM + '","' + data[i].PRJBDST + '","' + data[i].PRJCATEGORY + '","' + data[i].PRJMANAGERFULLNAME + '","' + data[i].BLOCKNAME + '","' + data[i].POSITION + '","' + data[i].BLOCKCENTER + '")')
    }
  })
};
//创建Role_PrjRoleUser视图表
export function createRole_PrjRoleUser(data) {
  store.state.SQLiteDB.transaction((tx) => {
    tx.executeSql('DROP TABLE IF EXISTS Role_PrjRoleUser');
    tx.executeSql('CREATE TABLE IF NOT EXISTS Role_PrjRoleUser(id unique,ROLEID,NAME,USER_ID,USER_NAME,USER_FULLNAME,USER_NO,GROUPPATHNAME,CREATE_DT,SORTID,PROJECTNAME,PROJECTID,PRJDEPTNAME,PRJDEPTID)');
    for (let i = 0; i < data.length; i++) {
      tx.executeSql('INSERT INTO Role_PrjRoleUser(id,ROLEID,NAME,USER_ID,USER_NAME,USER_FULLNAME,USER_NO,GROUPPATHNAME,CREATE_DT,SORTID,PROJECTNAME,PROJECTID,PRJDEPTNAME,PRJDEPTID) ' +
        'VALUES ("' + guid() + '","' + data[i].ROLEID + '","' + data[i].NAME + '","' + data[i].USER_ID + '","' + data[i].USER_NAME + '","' + data[i].USER_FULLNAME + '","' + data[i].USER_NO + '","' + data[i].GROUPPATHNAME + '","' + data[i].CREATE_DT + '","' + data[i].SORTID + '","' + data[i].PROJECTNAME + '","' + data[i].PROJECTID + '","' + data[i].PRJDEPTNAME + '","' + data[i].PRJDEPTID + '")')
    }
  })
};
//创建PMBASE_PRJMANAG表
export function createPMBASE_PRJMANAG(data) {
  console.log("创建PMBASE_PRJMANAG表")
  store.state.SQLiteDB.transaction((tx) => {
    tx.executeSql('DROP TABLE IF EXISTS PMBASE_PRJMANAG');
    tx.executeSql('CREATE TABLE IF NOT EXISTS PMBASE_PRJMANAG(id unique,GUID,SYSID,PMID,PMNAME,PMNO,QUALITYUSERFULLNAME6,QUALITYUSERNAME6,PMAREA,PMDETAIL,ATTACHMENTS,INPUTERFULLNAME,INPUTERNAME,INPUTDATE,AREAPOSITION,AREACENTER,INPUTDEPT,PHONE)');
    for (let i = 0; i < data.length; i++) {
      tx.executeSql('INSERT INTO PMBASE_PRJMANAG(id,GUID,SYSID,PMID,PMNAME,PMNO,QUALITYUSERFULLNAME6,QUALITYUSERNAME6,PMAREA,PMDETAIL,ATTACHMENTS,INPUTERFULLNAME,INPUTERNAME,INPUTDATE,AREAPOSITION,AREACENTER,INPUTDEPT,PHONE) ' +
        'VALUES ("' + guid() + '","' + data[i].GUID + '","' + data[i].SYSID + '","' + data[i].PMID + '","' + data[i].PMNAME + '","' + data[i].PMNO + '","' + data[i].QUALITYUSERFULLNAME6 + '","' + data[i].QUALITYUSERNAME6 + '","' + data[i].PMAREA + '","' + data[i].PMDETAIL + '","' + data[i].ATTACHMENTS + '","' + data[i].INPUTERFULLNAME + '","' + data[i].INPUTERNAME + '","' + data[i].INPUTDATE + '","' + data[i].AREAPOSITION + '","' + data[i].AREACENTER + '","' + data[i].INPUTEDEPT + '","' + data[i].PHONE + '")')
    }
  })
};
//创建V_FIX_GROUP表(根据项目id查找部门)
export function createV_FIX_GROUP(data) {
  store.state.SQLiteDB.transaction((tx) => {
    tx.executeSql('DROP TABLE IF EXISTS V_FIX_GROUP');
    tx.executeSql('CREATE TABLE IF NOT EXISTS V_FIX_GROUP(tempid unique,ORG_ID,ORG_GRADE,ID,NAME,PARENTID,ORG_PATHID,ORG_PATHNAME,VIRTUALPATHID,VIRTUALPATHNAME,VIRTUALSORTID,VIRTUALPARENTID,FLOORID,PRJID)');
    for (let i = 0; i < data.length; i++) {
      tx.executeSql('INSERT INTO V_FIX_GROUP(tempid,ORG_ID,ORG_GRADE,ID,NAME,PARENTID,ORG_PATHID,ORG_PATHNAME,VIRTUALPATHID,VIRTUALPATHNAME,VIRTUALSORTID,VIRTUALPARENTID,FLOORID,PRJID) ' +
        'VALUES ("' + guid() + '","' + data[i].ORG_ID + '","' + data[i].ORG_GRADE + '","' + data[i].ID + '","' + data[i].NAME + '","' + data[i].PARENTID + '","' + data[i].ORG_PATHID + '","' + data[i].ORG_PATHNAME + '","' + data[i].VIRTUALPATHID + '","' + data[i].VIRTUALPATHNAME + '","' + data[i].VIRTUALSORTID + '","' + data[i].VIRTUALPARENTID + '","' + data[i].FLOORID + '","' + data[i].PRJID + '")')
    }
  }, (err) => {
    console.log('错误789', err)
  })
};
// 插入数据
export function populateDB(tx) {
  //   tx.executeSql('DROP TABLE PMBASE_PRJMANAG_DETAIL IF EXISTS');
};
// 返回错误信息
export function errorCB(tx, err) {
  console.log("Error processing SQL: " + err);
};
// 返回成功信息
export function successCB() {
  console.log("success!");
};
// 获取所有项目列表
export function getprojectList() {

}
export default SQliteMethods
